<template>
  <div class="approval-wrap">
    <!--底部功能按钮-->
    <el-bottom-guide>
      <ul class="ccui-bottom-button">
        <li>
          <el-button type="bottom" icon="icon-ccui-return" @click="handleBack"
            >返回</el-button
          >
        </li>
        <!-- <template v-if="breadcrumbObj.name === '我的待阅'">
          <div class="ccui-bottom-guide-divider" />
          <li>
            <el-button type="bottom" @click="getUpdataRead">
              <img
                :src="require('@/basa/assets/images/read.png')"
                class="readImg"
              />
              已阅
            </el-button>
          </li>
          <div class="ccui-bottom-guide-divider" />
        </template> -->
        <div class="ccui-bottom-guide-divider" />
        <template v-for="(buttons, index) in approvalButtons">
          <li
            :key="index"
            v-if="
              JSON.stringify(approvalButtonAuth) !== '{}' &&
              approvalButtonAuth[buttons.type] !== '0'
            "
          >
            <el-button
              v-if="!buttons.noShow"
              type="bottom"
              :icon="buttons.icon"
              @click="buttons.click"
              >{{ buttons.text }}</el-button
            >
          </li>
        </template>
      </ul>
    </el-bottom-guide>
    <!--编辑弹出框-->
    <el-dialog
      title="供应商注册审批编辑"
      :visible.sync="dialogEdit"
      width="80%"
      height="1000px"
      custom-class="dialog-edit"
      v-if="dialogEditHack"
    >
      <iframe
        id="mainIframe"
        :src="iframeSrc"
        ref="mainIframe"
        name="mainIframe"
        style="width: 100%; height: 500px"
        frameborder="0"
      ></iframe>
    </el-dialog>
    <!--同意,不同意按钮弹出框-->
    <el-dialog
      title="审批意见"
      :visible.sync="dialogAgree"
      width="600px"
      custom-class="dialog-agree"
    >
      <div class="dialog-agree-title">
        <span>结论：</span>
        <span
          class="dialog-agree-title-agree"
          v-if="dialogAgreeType === 'agree'"
          >同意</span
        >
        <span
          class="dialog-agree-title-agree"
          v-else-if="dialogAgreeType === 'resubmit'"
          >重新提交</span
        >
        <span class="dialog-agree-title-disagree" v-else>不同意</span>
      </div>
      <div class="dialog-agree-content">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入审批意见"
          v-model="dialogAgreeValue"
          maxlength="500"
          show-word-limit
          resize="none"
        ></el-input>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="default-mini" @click="dialogAgree = false"
          >取 消
        </el-button>
        <el-button
          size="mini"
          type="primary-font-mini"
          @click="dialogAgreeSubmit(dialogAgreeType, ['dialogAgreeValue'])"
          >确 定
        </el-button>
      </div>
    </el-dialog>
    <!--退回按钮弹出框-->
    <el-dialog
      title="审批意见"
      :visible.sync="dialogReturn"
      width="940px"
      custom-class="dialog-return"
      @closed="dialogReturnClose"
    >
      <div class="dialog-body-left">
        <div class="dialog-body-title">
          <span>结论：退回 给</span>
          <!-- <div class="dialog-body-left-select" style="width: 458px">
            <el-tag
              :key="tag.id"
              v-for="tag in dialogReturnTags"
              closable
              :disable-transitions="false"
              type="info"
              size="small"
              @close="dialogReturnTagsClose(tag)"
              >{{ tag.name }}
            </el-tag>
            <img :src="require('@/basa/assets/images/triangle.png')" />
          </div> -->
          <el-select
            style="width: 460px; margin-left: 10px"
            v-model="selectTypeCode"
            @change="handleSelect"
            placeholder="请选择"
          >
            <el-option
              v-for="item in options"
              :key="item.label"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <div class="dialog-body-content">
          <el-input
            type="textarea"
            :rows="2"
            placeholder="请输入审批意见"
            v-model="dialogReturnValue"
            maxlength="500"
            show-word-limit
            resize="none"
          ></el-input>
        </div>
      </div>
      <!-- {{dialogReturnTags}} -->
      <!-- @click="dialogReturnPersonClick(item)" -->
      <div class="dialog-body-right">
        <ul>
          <li v-for="(item, index) in dialogReturnPerson" :key="index">
            <div>
              <span>{{ item.name }}</span>
              <span class="dialog-body-right-apply">
                {{
                  item.activityDefID === "startActivity"
                    ? "(申请人)"
                    : "(审批人)"
                }}
              </span>
            </div>
            <!-- 退回 显示下面企业 -->
            <div class="dialog-body-right-enterprise">
              {{ item.joinOrgName }}
            </div>
          </li>
        </ul>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="default-mini" @click="dialogReturn = false"
          >取 消
        </el-button>
        <el-button
          size="mini"
          type="primary-font-mini"
          @click="
            dialogAgreeSubmit('returnPerson', [
              'dialogReturnTags',
              'dialogReturnValue'
            ])
          "
          >确 定
        </el-button>
      </div>
    </el-dialog>
    <!--转审,协办弹出框-->
    <el-dialog
      v-if="dialogTransferReset"
      title="审批意见"
      :visible.sync="dialogTransfer"
      width="940px"
      custom-class="dialog-return"
      @closed="dialogTransferClose"
    >
      <div class="dialog-body-left">
        <div class="dialog-body-title">
          <span>
            结论：
            {{
              dialogTransferType === "transfer"
                ? "转审"
                : dialogTransferType === "assist"
                ? "协办"
                : "知会"
            }}
            给
          </span>
          <template v-if="dialogTransferType == 'notify'">
            <el-select
              v-model="dialogTag"
              multiple
              placeholder="选择"
              :style="{ width: '82.6%' }"
              @change="handleChangeTag"
              collapse-tags
            >
              <el-option
                v-for="tag in dialogTransferTags"
                :key="tag.id"
                :label="tag.name"
                :value="tag.id"
              ></el-option>
            </el-select>
          </template>
          <div class="dialog-body-left-select" v-else>
            <el-tag
              :key="tag.id"
              v-for="tag in dialogTransferTags"
              closable
              :disable-transitions="false"
              type="info"
              size="small"
              @close="dialogTransferTagsClose(tag)"
              >{{ tag.name }}
            </el-tag>
            <img :src="require('@/basa/assets/images/triangle.png')" />
          </div>
        </div>
        <div class="dialog-body-content">
          <el-input
            type="textarea"
            :rows="2"
            placeholder="请输入审批意见"
            v-model="dialogTransferValue"
            maxlength="500"
            show-word-limit
            resize="none"
          ></el-input>
        </div>
      </div>
      <div class="dialog-body-right">
        <el-tree
          :show-line="true"
          :props="dialogTransferDefaultProps"
          :load="dialogTransferLoadNode"
          node-key="partyId"
          :highlight-current="true"
          :default-expanded-keys="expandedKeys"
          ref="tree"
          lazy
          @node-click="dialogTransferNodeClick"
        ></el-tree>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button
          size="mini"
          type="default-mini"
          @click="dialogTransfer = false"
          >取 消
        </el-button>
        <el-button
          size="mini"
          type="primary-font-mini"
          @click="
            dialogAgreeSubmit(dialogTransferType, [
              'dialogTransferTags',
              'dialogTransferValue'
            ])
          "
          >确 定
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mixinCommon } from "./mixin-common";
export default {
  name: "approval-operate",
  mixins: [mixinCommon],
  data() {
    return {};
  },
  created() {},
  methods: {}
};
</script>

<style lang="scss">
@import "./template-dialog.scss";
.approval-wrap {
  .el-bottom-guide {
    display: block !important;
  }
}
</style>
